<%--
  Created by IntelliJ IDEA.
  User: 83536
  Date: 2018/1/31
  Time: 9:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html>
<head>
    <title>Title</title>
    <%@include file="/WEB-INF/jsp/comm/head.jsp"%>
</head>
<body>
<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            条件查询
        </div>
        <div class="panel-body">
            <form class="form-inline">
                <div class="form-group">
                    <label>消缺任务编号：</label>
                    <input type="text" name="soleTaskCode" class="form-control"/>
                </div>
                <div class="form-group">
                    <label>任务状态名称：</label>
                    <input type="text" name="taskStatusName" class="form-control"/>
                </div>
                <div class="form-group">
                    <button type="button" class="btn btn-danger" onclick="search()"><i class="glyphicon glyphicon-search"></i> 查询</button>
                </div>
            </form>
        </div>
    </div>

    <button class="btn btn-danger" onclick="addUser()" type="button"><i class="glyphicon glyphicon-plus-sign"></i> 添加</button>
    <table id="solveTb"
            data-toggle="table"
            data-url="${ctx}/skm/skm/skmShow"
            data-striped="true"
            data-pagination="true"
            data-side-pagination="server"
            data-page-size="4"
            data-page-list="[4,8,12,16]"
            data-query-params="queryParams"
            data-toolbar="toolbar">
        <thead>
        <tr>
            <th data-field="solveTaskCode">消缺任务编号</th>
            <th data-field="solveTaskName">消缺任务名称</th>
            <th data-field="workDocTypename">工作单据NAME</th>
            <th data-field="taskManagerCode">任务负责人CODE</th>
            <th data-field="taskStatusName" data-formatter="taskFor">任务状态名称</th>
            <th data-field="finishTime">任务完成时间</th>
            <th data-field="issuedTime">任务下发时间</th>
            <th data-field="isCancel"data-formatter="fmtState">是否取消</th>
            <th  data-events="events" data-formatter="fmtOpt">操作</th>
        </tr>
        </thead>
    </table>
</div>
<div id="getIdShow">
    <form action="" class="form-horizontal">
        <div class="form-group">
            <div class="col-md-6">
                <div class="col-md-10">
                    <input type="hidden" name="id" class="form-control">
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">消缺任务编号:</label>
                    <div class="col-md-8">
                        <input type="text" name="solveTaskCode" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作单据ID:</label>
                    <div class="col-md-8">
                        <input type="text" name="workDocType" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作单据NAME:</label>
                    <div class="col-md-8">
                        <input type="text" name="workDocTypename" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务描述:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskDesc" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务负责人CODE:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskManagerCode" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务负责人NAME:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskManagerName" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务状态ID:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskStatus" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务状态名称:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskStatusName" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务完成时间:</label>
                    <div class="col-md-8">
                        <input type="text" name="finishTime" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">创建日期备注:</label>
                    <div class="col-md-8">
                        <input type="text" name="common" class="form-control" readonly="readonly">
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">负责人审查意见:</label>
                    <div class="col-md-8">
                        <input type="text" name="managerSuggestion" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">完成情况描述:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskFinishDesc" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作终结报告:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskFinishReport" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作间断延期记载:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskNotes" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人CODE:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedBycode" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人NAME:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedByname" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务下发时间:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedTime" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人审查意见:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedSuggestion" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">是否取消:</label>
                    <div class="col-md-8">
                        <input type="text" name="isCancel" class="form-control" readonly="readonly">
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<div id="update">
    <form class="form-horizontal" method="post">
        <div class="form-group">
            <div class="col-md-6">
                <div class="col-md-10">
                    <input type="hidden" name="id" class="form-control">
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">消缺任务编号:</label>
                    <div class="col-md-8">
                        <input type="text" name="solveTaskCode" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">消缺任务名称:</label>
                    <div class="col-md-8">
                        <input type="text" name="solveTaskName" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作单据ID:</label>
                    <div class="col-md-8">
                        <input type="text" name="workDocType" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作单据NAME:</label>
                    <div class="col-md-8">
                        <input type="text" name="workDocTypename" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务描述:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskDesc" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务负责人CODE:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskManagerCode" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务负责人NAME:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskManagerName" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务状态ID:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskStatus" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务状态名称:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskStatusName" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务完成时间:</label>
                    <div class="col-md-8">
                        <input type="text" name="finishTime" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">创建日期备注:</label>
                    <div class="col-md-8">
                        <input type="text" name="common" class="form-control">
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">负责人审查意见:</label>
                    <div class="col-md-8">
                        <input type="text" name="managerSuggestion" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">完成情况描述:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskFinishDesc" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作终结报告:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskFinishReport" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作间断延期记载:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskNotes" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人CODE:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedBycode" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人NAME:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedByname" class="form-control" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务下发时间:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedTime" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人审查意见:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedSuggestion" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">是否取消:</label>
                    <div class="col-md-8">
                        <select name="isCancel">
                            <option value="0">否</option>
                            <option value="1">是</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<div id="add">
    <form action="" class="form-horizontal" method="post">
        <div class="form-group">
            <div class="col-md-6">
                <div class="col-md-10">
                    <input type="hidden" name="id" class="form-control">
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">消缺任务编号:</label>
                    <div class="col-md-8">
                        <input type="text" name="solveTaskCode" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">消缺任务名称:</label>
                    <div class="col-md-8">
                        <input type="text" name="solveTaskName" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作单据ID:</label>
                    <div class="col-md-8">
                        <input type="text" name="workDocType" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作单据NAME:</label>
                    <div class="col-md-8">
                        <input type="text" name="workDocTypename" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务描述:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskDesc" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务负责人:</label>
                    <div class="col-md-8">
                        <select id="one" class="form-control" name="taskManagerCode" onchange="func(this.value)">
                            <option value="-1">--请选择--</option>
                            <option value="线程编号1">线程编号1</option>
                            <option value="线程编号2">线程编号2</option>
                            <option value="线程编号3">线程编号3</option>
                            <option value="线程编号4">线程编号4</option>
                            <option value="线程编号5">线程编号5</option>
                            <option value="线程编号6">线程编号6</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="" class="col-md-4 control-label"></label>
                    <div class="col-md-8">
                        <select id="two" class="form-control" name="taskManagerName">
                            <option value="-1">--请选择--</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务状态ID:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskStatus" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务状态名称:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskStatusName" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务完成时间:</label>
                    <div class="col-md-8">
                        <input type="text" name="finishTime" class="form-control">
                    </div>
                </div>

            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">创建日期备注:</label>
                    <div class="col-md-8">
                        <input type="text" name="common" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">负责人审查意见:</label>
                    <div class="col-md-8">
                        <input type="text" name="managerSuggestion" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">完成情况描述:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskFinishDesc" class="form-control">
                    </div>
                </div>

                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作终结报告:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskFinishReport" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">工作间断延期记载:</label>
                    <div class="col-md-8">
                        <input type="text" name="taskNotes" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人CODE:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedBycode" value="${loginUser.userCode}" readonly="readonly" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人NAME:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedByname" value="${loginUser.userName}" readonly="readonly" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">任务下发时间:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedTime" class="form-control" id="shijian">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-4 control-label">下发人审查意见:</label>
                    <div class="col-md-8">
                        <input type="text" name="issuedSuggestion" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-8">
                        <input type="hidden" name="isCancel" class="form-control" value="0">
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<%@include file="/WEB-INF/jsp/comm/foot.jsp"%>
<script src="/static/myjs/solvetaskmain.js"></script>
<script>
     /*
    二级联动
    */
    var two = document.getElementById('two');
    city = [];
    city["线程编号1"] = ['线程测试员一号'];
    city["线程编号2"] = ['线程测试员二号'];
    city["线程编号3"] = ['线程测试员三号'];
    city["线程编号4"] = ['线程测试员四号'];
    city["线程编号5"] = ['线程测试员五号'];
    city["线程编号6"] = ['线程测试员六号'];
    function func(m){
        two.length = 1;
        for (var i = 0; i < city[m].length; i++) {
            var op = new Option(city[m][i],city[m][i]);
            two.append(op);
        };
    }


    function taskFor(value,row){
        if(value=="待分配"){
            return "<span style='color: orange'>待分配</span>"
        }else if(value=="已分配"){
            return "<span style='color: blue'>已分配</span>"
        }else if(value=="执行中"){
            return "<span style='color: purple'>执行中</span>"
        }else{
            return "<span style='color: green'>已完成</span>"
        }
    }
    laydate.render({
        elem:'#add [name=issuedTime]'
        }
    );
    laydate.render({
            elem:'#add [name=finishTime]'
        }
    );
    /**
     * 添加计划
     */
    $(function(){
        $("#getIdShow").dialog({title:'详情',size:'modal-lg'});
        $("#add").dialog({title:'制定消缺计划',size:'modal-lg',btnName:"确认",
            btnBind:function(){
                var param=$("#add form").serialize();
                alert(param);
                $.post(ctx+"skm/skm/add",param,function(msg){
                    toastr.warning("信息提示",msg);
                    $("#add").dialog("close");
                    $("#add form")[0].reset();
                    $("#solveTb").bootstrapTable("refresh");
                },'text')
            }
        })
    });

    function fmtOpt(){
        var getShow = `<button class="btn btn-info btn-sm getShow">查看详情</button>`;
        var update = `      <button class="btn btn-danger btn-sm update">修改用户</button>`;
        return getShow+update;
    }
/*
*/
    var events = {
        "click .getShow":function(e,value,row){
            getShow(row);
        },
        "click .update":function(e,value,row){
            update(row);
        }
    }
    /**
     *
     * 查看详情
     * @param row
     */
    function getShow(row){
        for(var prop in row){
            if(prop == 'isCancel'){
                var a = row[prop] == 1 ? '是' : '否';
                $("#getIdShow").find("[name="+prop+"]").val(a);
                continue;
            }
            $("#getIdShow").find("[name="+prop+"]").val(row[prop]);
        }
        $("#getIdShow").dialog("open");
    }

    /**
     * 修改
     */
    $(function(){
        $("#update").dialog({
            title:"修改用户",
            btnName:"确定",
            size:'modal-lg',
            btnBind:function(){
                var param=$("#update form").serialize();
                $.post(ctx+"skm/skm/update",param,function(msg){
                    toastr.warning("信息提示",msg);
                    $("#update").dialog("close");
                    $("#solveTb").bootstrapTable("refresh");
                },'text');
            }
        });
    });
    function update(row) {
        for(var prop in row){
            $("#update").find("[name="+prop+"]").val(row[prop]);
        }
        $("#update").dialog("open");
    };
    /**
     * 增加模态框
     */
    function addUser(){
        $("#add").dialog("open");
    };
</script>
</body>
</html>
